// 基础消息接口
interface BaseMessage {
  id?: number;
  senderId: number;
  content: string;
  messageType: number;
  contentType: ContentType;
  status: number;
  createTime?: string;
  fileName?: string;
  fileSize?: number;
  type?: number;
}

// 私聊消息接口
export interface PrivateMessage extends BaseMessage {
  receiverId: number;
  readStatus: number;
}

// 群聊消息接口
export interface GroupMessage extends BaseMessage {
  groupId: number;
}

// 通用消息类型(用于WebSocket等场景)
export type ChatMessage = PrivateMessage | GroupMessage;

// 消息类型枚举
export enum MessageType {
  PRIVATE = 1,
  GROUP = 2,
}

// 消息状态枚举
export enum MessageStatus {
  SENDING = 0,
  SENT = 1,
  READ = 2,
}

// 消息读取状态枚举
export enum ReadStatus {
  UNREAD = 0,
  READ = 1,
}

export enum ContentType {
  TEXT = 0,
  IMAGE = 1,
  FILE = 4,
  VOICE = 2,
  VIDEO = 3,
}

export interface MessageRecord {
  id: number;
  userId: number;
  friendId: number;
  lastReadTime: string;
  unreadCount: number;
}
